﻿<!DOCTYPE HTML>
<html>
<meta charset="UTF-8">
<title>Ants框架Doc文档</title>
<link href="./css/bootstrap.css" rel="stylesheet">
<link href="./css/index.css" rel="stylesheet">
<link href="./css/shCoreDefault.css" rel="stylesheet">
<body>
<div class="header">
    <div class="logo" style="margin-left:10px;"><img src="./images/logo.png"/></div>
    <div style="padding:12px 0 0 5px;float:left;"><span style="font-size:18px;">Java Ants Doc</span> <span
            style="font-size:10px;"></span></div>
    <div class="nav-box">

    </div>
</div>
<div>
    <div class="navbar">
        <ul class="menu">

        </ul>
    </div>
    <div class="main">

    </div>
</div>
<script src="./js/jquery.min.js"></script>
<script src="./js/sh/shCore.js"></script>
<script type="text/javascript" src="./js/sh/shBrushBash.js"></script>
<script type="text/javascript" src="./js/sh/shBrushCpp.js"></script>
<script type="text/javascript" src="./js/sh/shBrushCSharp.js"></script>
<script type="text/javascript" src="./js/sh/shBrushCss.js"></script>
<script type="text/javascript" src="./js/sh/shBrushDelphi.js"></script>
<script type="text/javascript" src="./js/sh/shBrushDiff.js"></script>
<script type="text/javascript" src="./js/sh/shBrushGroovy.js"></script>
<script type="text/javascript" src="./js/sh/shBrushJava.js"></script>
<script type="text/javascript" src="./js/sh/shBrushJScript.js"></script>
<script type="text/javascript" src="./js/sh/shBrushPhp.js"></script>
<script type="text/javascript" src="./js/sh/shBrushPlain.js"></script>
<script type="text/javascript" src="./js/sh/shBrushPython.js"></script>
<script type="text/javascript" src="./js/sh/shBrushRuby.js"></script>
<script type="text/javascript" src="./js/sh/shBrushScala.js"></script>
<script type="text/javascript" src="./js/sh/shBrushSql.js"></script>
<script type="text/javascript" src="./js/sh/shBrushVb.js"></script>
<script type="text/javascript" src="./js/sh/shBrushXml.js"></script>
<script type="text/javascript">
    $(function () {
        //点击展开菜单
        // $(document).on("click", "ul.menu>li>div.title", function () {
        //     var smenu = $(this).parent().find("ul.submenu");
        //     if (smenu.length == 0) return;
        //     if (smenu.is(':visible')) {
        //         $(this).find("img:eq(0)").attr("src", "./images/folder.gif");
        //         $(this).find("img:eq(1)").attr("src", "./images/right.png");
        //         //smenu.animate({height:0}, 3000, function(){
        //         //});
        //         smenu.slideUp();
        //     } else {
        //         $(".submenu").slideUp();
        //         $(this).find("img:eq(0)").attr("src", "./images/folder-open.gif");
        //         $(this).find("img:eq(1)").attr("src", "./images/bottom.png");
        //         smenu.slideDown();
        //     }
        //
        // });

        var loadPage = function(url){
            var t = new Date().getTime();
            $(this).siblings().removeClass("active").end().addClass("active");
            $("body").append('<div class="loading"><img src="./images/loading.gif" /></div>');
            $.get(url + "?" + t, function (page) {
                $("div.main").css("opacity", 0);
                setTimeout(function () {
                    $("div.main").html(page);
                    $("div.main").animate({
                        opacity: 1
                    }, 500, function () {
                        $("div.loading").remove();
                    });
                }, 700);
            }, "html");
        }

        //点击子菜单
        $(document).on("click", "ul.submenu>li", function () {
            var dataUrl = $(this).attr("data-url");
            loadPage(dataUrl);
            localStorage.setItem("dataUrl", dataUrl);
        });

        //点击导航项目
        $(document).on("click", "div.nav-box>div", function () {
            $(this).siblings().removeClass("active").end().addClass("active");
            var _index = $(this).index();
            $.get("config.json?" + new Date().getTime(), function (res) {
                var _menu = '';
                $.each(res[_index].data, function (i, ob) {
                    _menu += '<li>' +
                            '<div class="title"><img src="./images/folder.gif"/> ' + ob.name + '<img class="arrow" src="./images/right.png"/></div>' +
                            '<ul class="submenu">';
                    $.each(ob.data, function (i, o) {
                        var icon = './images/api.svg';
                        if (o.icon) icon = o.icon;
                        _menu += '<li data-url="./' + o.url + '"><img src="' + icon + '"/> ' + o.name + '</li>'
                    });
                    _menu += '</ul>' +
                            '</li>';
                });
                $("ul.menu").html(_menu);
            }, "json");
        });

        $.get("config.json?" + new Date().getTime(), function (data) {
            $("div.nav-box").empty();
            $.each(data, function (i, obj) {
                var act = '';
                if (i == 0) act = ' active';
                $("div.nav-box").append('<div class="nav fl' + act + '">' + obj.name + '</div>');
            });
            $("div.nav-box>div").eq(0).trigger("click");
        }, "json");

        //加载默认页面
        var dataUrl = localStorage.getItem("dataUrl");
        loadPage(dataUrl == null ? "page/ants/framework/summary.html": dataUrl);
        $("ul.menu").css("height", ($(window).height() - 60) + "px");
        $(window).resize(function(){
            $("ul.menu").css("height", ($(window).height() - 60) + "px");
        });
    });
</script>
</body>
</html>